<!DOCTYPE html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml"
      xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
    <title>文档类型</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="refresh" content="1200">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/dist/plugins/bootstrap/css/bootstrap.min.css">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <!--图标-->
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <!--插件样式-->
    <link href="/dist/plugins/umeditor1.2.3-src/themes/default/_css/umeditor.css" rel="stylesheet" />
    <link rel="stylesheet" href="/dist/plugins/webuploader-0.1.5/webuploader.css">
    <link rel="stylesheet" href="/dist/plugins/select2/select2.min.css">
    <!--OA主样式-->
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=e9c5bb62">
    <link rel="stylesheet" href="/dist/css/skins/OA-skins.min.css?t=66b457d6">
    <style>
        table input {
            border: none;
            width: 100%;
        }

        .lineOne {
            text-align: left;
        }

        .lineOne span {
            max-height: 20px;
            line-height: 20px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
            text-align: left;
        }

        .div-td-content-more {
            position: absolute;
            height: auto;
            z-index: 999;
            line-height: 20px;
            background-color: #d3e8fd;
            padding: 8px 6px;
            border: 1px solid #e8e8ea;
            display: none;
        }

        .div-td-content-more i {
            width: 15px;
            height: 12px;
            background: url("/dist/img/more-icon.png");
            position: absolute;
            left: 50px;
            top: -12px;
        }
        .lineOne {
            text-align: left;
        }

        .lineOne span {
            max-height: 20px;
            line-height: 20px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
            text-align: left;
        }.webuploader-container {
             position: relative;
             margin-top: 15px;
         }
        #divUploadedFiles{
            padding: 20px 10px;
            border:1px dashed  #ddd;
            width:50%;
        }
    </style>
</head>
<body>
<section class="content" id="app" v-cloak=>
    <iframe id="ifExprot" style="width:0px;height:0px;display: none;" frameborder="0"></iframe>
    <div class="box-header" style="text-align:left; padding-bottom: 10px;padding-left: 30px;">
        <input type="text" placeholder="搜索文档名字" id="searchKey" size="12"  v-model="key" class="form-control pull-left input-sm" style="width: 180px;">
        <button type="button" class="btn oaBtn btn-sm pull-left" @click="sel()" style="margin-left: 10px;">查询</button>
        <button type="button" class="btn oaBtn btn-sm pull-left" @click="add()" style="margin-left: 10px;">添加</button>
    </div>
    <div class="box-body no-padding iframeH2" style="overflow: auto;" id="scrollDiv">
            <table class="table table-bordered text-center table-width">
                    <thead>
                    <tr class="td-module"style="height:25px">
                        <th style="width:10%">序号</th>
                        <th style="width:15%">文档名字</th>
                        <th style="width:40%">文档URL</th>
                        <th style="width:10%">文档状态</th>
                        <th style="width:15%">操作文档</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr v-for="(item,i) in list" style="height: 40px">
                        <td >
                            <span>{{i+1}}</span>
                        </td>
                        <td  >
                            <span>{{item.name}}</span>
                        </td>
                        <td >
                            <span>{{item.url}}</span>
                        </td>
                        <td >
                            <span>{{item.delFlag}}</span>
                        </td>
                        <td>
                            <span><a @click="gotoDetail(item.id)" style="cursor: pointer"><strong>修改</strong></a></span>
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                            <span><a @click="deleteFile(item.id)" style="cursor: pointer"><strong>删除</strong></a></span>
                        </td>
                    </tr>
                    </tbody>
            </table>
        <div class="oa-pager text-center" style="margin-top: 5px;">
            共
            <span id="allCount"> 0 </span>条记录&nbsp;&nbsp;&nbsp;
            <span id="nowPage"> 1 </span>/<span id="allPage">1</span>&nbsp;&nbsp;&nbsp;
            <span class="oa-pager-button" id="first">首页</span>
            <span class="oa-pager-button" id="prev">上一页</span>
            <span class="oa-pager-button" id="next">下一页</span>
            <span class="oa-pager-button" id="last">尾页</span>
        </div>
    </div>

</section>

</body>
<!--JQ-->
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="https://file.ggxqce.com/web/bootstrap.min.js"></script>
<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<script src="/dist/plugins/webuploader-0.1.5/webuploader.min.js"></script>
<script src="/dist/plugins/select2/select2.full.min.js"></script>
<!--框架已定义 JS-->
<script src="/dist/js/app_iframe.js?t=0b5caf39"></script>
<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>
<!--oa自定义  JS-->
<script src="/dist/js/oa.js?t=0c4d95a9"></script>

<!--插件JS-->
<script src="https://file.ggxqce.com/web/bootstrap.min.js"></script>
<!--框架已定义 JS-->
<script src="/dist/js/app_iframe.js?t=7e54a132"></script>
<!--oa自定义  JS-->
<script src="/dist/js/oa.js?t=63aed32f"></script>

<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<script type="text/javascript" src="/dist/plugins/My97DatePicker/WdatePicker.js"></script>
<script>
    $(function () {
        $("body").on("click", ".lineOne", function (e) {
            if ($(".div-td-content-more").is(":hidden")) {
                var text = $(this).text();
                if (text != "") {
                    text = "<i></i>" + text;
                    $(".div-td-content-more").html(text).css({
                        "width": $(this).outerWidth() + "px",
                        "left": $(this).offset().left,
                        "top": ($(this).offset().top + $(this).outerHeight()) + "px"
                    }).show();
                    e.stopPropagation();
                }
            } else {
                $(".div-td-content-more").hide();
            }
        });
        $("body").on("click", ".div-td-content-more", function (e) {
            e.stopPropagation();
        });
        $("body").on("click", function () {
            $(".div-td-content-more").hide();
        });
    });
</script>

<script type="text/javascript">
    var app = new Vue({
        el: '#app',
        data: {
            name:'',
            url:'',
            delFlag:'0',
            list:[],
            pager:{},
            key:''
        },
        methods: {
            sel :function () {
                var that = this;
//                $.wyui.postMethod("/docType/getTypeListByPage.json",
//                    {key: that.key},
//                    function (data){
//                        that.list = data.records;
//                        that.pager = data.pager;
//                    });
                var data = {
                    'key': that.key
                };
                $.wyui.page.queryParams.requestPage = 1;
                $.extend($.wyui.page.queryParams,data);
                $.wyui.page.getByPage();

            },
            selALL :function () {
                var that = this;
//                that.key = '';
//                $.wyui.postMethod("/docType/getTypeListByPage.json",
//                    {},
//                    function (data){
//                        that.list = data.records;
//                        that.pager = data.pager;
//                    });
                var data = {
                    'key': ''
                };
                $.wyui.page.queryParams.requestPage = 1;
                $.extend($.wyui.page.queryParams,data);
                $.wyui.page.getByPage();

            },
            add: function(){
                $.dialog({
                    content: 'url:typeDetail.html',
                    //content: 'url:saveType.html',
                    title: '创建类型',
                    width: 500,
                    height: 250,
                    max: true,
                    min: true,
                    lock: true
                });
            },
            gotoDetail:function (id) {
                $.dialog({
                    content: 'url:typeDetail.html?id='+id,
                    //content: 'url:updateType.html?id='+id,
                    title: '修改类型',
                    width: 500,
                    height: 250,
                    max: true,
                    min: true,
                    lock: true
                });
            },
            deleteFile:function (id) {
                var that=this;
                if(confirm("确定要删除该文档吗？")){
                    $.wyui.postMethod('/docType/delById.json', {id:id}, function (r) {
                        that.sel();
                    });
                }
            }
        },
        mounted: function () {
            var that = this;
           // $.wyui.page.getByPage();
            $.wyui.postMethod('/docType/getTypeListByPage.json',{}, function (data) {
                that.list = data.records;
                that.pager = data.pager;
            });
        }
    });
    //分页
    $.wyui.page.dataUrl = server.ip + "/docType/getTypeListByPage.json";
    $.wyui.page.queryParams.pageType = $.wyui.page.urlParams.pageType;
    $.extend($.wyui.page.queryParams);
    $.wyui.page.getByPage_callback = function (records) {
        console.log(records)
        app.list = records;
        document.getElementById("scrollDiv").scrollTop = 0;
    };
    $.wyui.page.getByPage_scroll_callback = function (list) {
        if (list.length < 30) {
            isLoad = false;
        } else {
            for (var i = 0; i < list.length; i++) {
                app.list.push(list[i]);
            }
            isLoad = true;
        }
    };
</script>

</html>